package com.evan.kdl.test.day02;

import cn.hutool.core.date.StopWatch;
import com.evan.kdl.test.day02.service.ComparePriceService;
import com.evan.kdl.test.entity.PriceResultVo;

/**
 * @author huangzhongliang
 * @time 2024/01/18 18:14
 */
public class ComparePriceDemo3 {
    public static void main(String[] args) {
        // 方案三测试：使用 CompletableFuture 进一步增强并行
        //processed cost 1.07 second
        ComparePriceService service = new ComparePriceService();
        StopWatch sw = new StopWatch();
        sw.start();
        PriceResultVo priceResultVo = service.getCheapestPlatformPrice3("iphone");
        sw.stop();
        System.out.printf("processed cost %.2f second", sw.getTotalTimeSeconds());
        System.err.println("priceResultVo = " + priceResultVo);
    }
}
